<h1>Dashboard</h1>

<h2>Welcome to your administration section.</h2>

<div id="tabPanel1" class='tab-pane'>    
    <div id="tabPage1" class='tab-page'>

        <h2 class='tab'>Recent News Posts</h2>  
        <?php 
        if ( isset($news) && count($news) > 0 )
        {
            $odd_or_even = 0;
            echo '<ul class="dashboard_ul">';
            foreach( $news as $item )
            {
                $odd_or_even = 1 - $odd_or_even;
                echo content_tag(
                        'li',
                         date_format($item['created'],'%D').' - '.link_to($item['title'],
                                 array('controller'=>'admin/news' ,'action'=>'modify?id='.$item['id'])),                                
                                 array('class'=>'alt'.$odd_or_even)
                                );
            }
            echo '</ul>';
            echo content_tag('p', link_to('Write a news story',array('controller'=>'admin/news' ,'action'=>'modify')
            ));
            
        } else {
            echo content_tag(
                    'p',
                    'You currently do not have any news stories. '.
                    link_to('You should write one.',array('controller'=>'admin/news' ,'action'=>'modify')
                    )
                );
        }
        ?>    
    </div>
        
    <div id="tabPage2" class='tab-page'>
        <h2 class='tab'>Recent Pages</h2>
        <?php 
        if ( isset($pages) && count($pages) > 0 )
        {
            $odd_or_even = 0;
            echo '<ul class="dashboard_ul">';
            foreach( $pages as $item )
            {
                $odd_or_even = 1 - $odd_or_even;
                echo content_tag(
                        'li',
                         date_format($item['created'],'%D').' - '.link_to($item['title'], 
                                 array('controller'=>'admin/pages' ,'action'=>'?pages%5Bid%5D='.$item['id'])),                                 
                                 array('class'=>'alt'.$odd_or_even)
                                );
            }
            echo '</ul>';
            echo content_tag('p', link_to('Create a new page',array('controller'=>'admin/pages' )
            ));           
        } else {
            echo content_tag(
                    'p',
                    'You currently do not have any pages. '.
                    link_to('You should create one.',array('controller'=>'admin/pages' )
                    )
                );
        }
        ?>      
        
    </div>
    
    <div id="tabPage3" class='tab-page'>
        <h2 class='tab'>Recent Inbox Inquiries</h2>
        <?php 
        if ( isset($leads) && count($leads) > 0 )
        {
            $odd_or_even = 0;
            echo '<ul class="dashboard_ul">';
            foreach( $leads as $item )
            {
                $odd_or_even = 1 - $odd_or_even;
                $the_lead = htmlentities($item['first_name']. ' '.$item['last_name']);
                echo content_tag(
                        'li',
                         date_format($item['created'],'%D').' - '.
                                link_to($the_lead, 
                                    array('controller'=>'admin/inbox' ,'action'=>'view_lead?id='.$item['id']))
                                            .' ['.htmlentities($item['email']).']',
                                 array('class'=>'alt'.$odd_or_even)
                                );
            }
            echo '</ul>';
            echo content_tag('p', link_to('View all form submissions',array('controller'=>'admin/inbox' ,'action'=>'leads')
            ));
        } else {
            echo "<p>You do not have any form submissions yet. ";
            if ( count($forms) < 1 )
            {
                echo "<br />Of course you don't have any forms set up yet. "
                     .link_to('Set up a form.',array('controller'=>'admin/inbox' )
                     )."</p>";
            }
        }
        ?>      
    </div>       
    
</div>


<script type="text/javascript">
    setupAllTabs();
</script>
